package com.atguigu.gulimall.order.vo;

import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.List;

public class OrderConfirmVo {
    //防止重复提交

    @Setter @Getter
    String orderToken;


    //收货地址
    @Setter  @Getter
    List<MemberAddressVo> memberAddressVos;

    //所选择的购物项
    @Setter  @Getter
    List<OrderItemVo> orderItemVos;

    //发票记录

    // 优惠券信息
    @Setter @Getter
    Integer integration = 0;



    public BigDecimal getTotal() {
            BigDecimal total = new BigDecimal(0);
            if(orderItemVos!=null){
                for (OrderItemVo orderItemVo : orderItemVos) {
                    BigDecimal price = orderItemVo.getPrice().multiply(new BigDecimal(orderItemVo.getCount().toString()));
                    total=total.add(price);
                }
            }
            return total;
    }


    public BigDecimal getPayPrice() {
        return getTotal();
    }


}

